home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 407 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.9 KB

  1. Path: chronicle.mti.sgi.com!austern
  2. From: "Paul D. DeRocco" <pderocco@ix.netcom.com>
  3. Newsgroups: comp.std.c++
  4. Subject: Re: typedef not strong
  5. Date: 20 Feb 1996 10:50:00 PST
  6. Organization: Netcom
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <31285017.4BFA@ix.netcom.com>
  9. References: <4g5sm4$dtt@natasha.rmii.com> <r4d97clcgj.fsf@erawan.cognex.com>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: Mon, 19 Feb 1996 05:25:27 -0500
  12. X-Netcom-Date: Mon Feb 19  2:31:58 AM PST 1996
  13. X-Mailer: Mozilla 2.0b6a (Win95; I)
  14. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  15.     iQBVAwUBMSoX50y4NqrwXLNJAQFA9AH+Kvise9NNXDiQ2MkcWpK/CaByz/J8yKon
  16.     slJK7PWhWTWelYjtOXQp9KF6Btt9Ov/0e60tYBhGuqpCzoEE+Yol3Q==
  17.     =tTZY
  18. Originator: austern@isolde.mti.sgi.com
  19.  
  20. The disadvantage of "class" is that it creates a structure type. If you 
  21. want to create a new arithmetic type, you can do that with "class", but 
  22. you have to define all the arithmetic operators over again, using 
  23. inlines. The Borland compiler, for one, will let you do that, but it 
  24. will never generate code quite as efficient as it will for the built-in 
  25. types, where it is happy to do arithmetic (addition and subtraction, at 
  26. least) in whatever registers are most convenient.
  27.  
  28. Perhaps we need a syntax like:
  29.  
  30.     class myint: public int;
  31.     class specialint: public myint;
  32.  
  33. so a myint could be used where an int was expected, and a specialint 
  34. could be used where a myint was expected.
  35.  
  36. But as soon as we do that, people will want to specify valid ranges for 
  37. the types, a la Ada, which adds another whole level of complexity.
  38.  
  39. -- 
  40.  
  41. Ciao,
  42. Paul D. DeRocco
  43. ---
  44. [ To submit articles: Try just posting with your newsreader.  If that fails,
  45.                       use mailto:std-c++@ncar.ucar.edu
  46.   FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  47.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  48.   Comments? mailto:std.c++-request@ncar.ucar.edu 
  49. ]
  50.